<html><head><title>ComboBoxGadget</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">ComboBoxGadget()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#006666"><b>ComboBoxGadget</b></font>(#Gadget, x, y, Width, Height [, Flags])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Create a ComboBox gadget in the current GadgetList. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Gadget</i></td>
<td width="90%"> 
A number to identify the new gadget. <a href="../reference/purebasic_objects.html">#PB_Any</a> can 
be used to auto-generate this number. 

</td></tr>
<tr><td><i>x, y, Width, Height</i></td>
<td> 
The position and dimensions of the new gadget. 
<b>Note</b>: on OS X, the height of a combobox can't be changed and this parameter will be ignored. 

</td></tr>
<tr><td><i>Flags (optional)</i></td>
<td> 
Flags to modify the gadget behavior. It can be composed (using the '|' operator) of one of the following constants: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_ComboBox_Editable</font>  : Makes the ComboBox editable
  <font color="#924B72">#PB_ComboBox_LowerCase</font> : All text entered in the ComboBox will be converted to lower case.
  <font color="#924B72">#PB_ComboBox_UpperCase</font> : All text entered in the ComboBox will be converted to upper case.
  <font color="#924B72">#PB_ComboBox_Image</font>     : Enable support for images in items (not supported for editable ComboBox on OSX)
</font></pre>

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns nonzero on success and zero on failure. If <font color="#924B72">#PB_Any</font> was used as the #Gadget parameter 
then the return-value is the auto-generated gadget number on success. 

</blockquote><p><b>Remarks</b></p><blockquote>

A 'mini help' can be added to this gadget using <a href="gadgettooltip.html">GadgetToolTip()</a>. 
<br>
<br>
The following functions can be used to act on the list contents: 
<br>
<br>
- <a href="addgadgetitem.html">AddGadgetItem()</a>: Add an item. 
<br>
- <a href="getgadgetitemtext.html">GetGadgetItemText()</a>: Returns the gadget item text. 
<br>
- <a href="countgadgetitems.html">CountGadgetItems()</a>: Count the items in the current combobox. 
<br>
- <a href="cleargadgetitems.html">ClearGadgetItems()</a>: Remove all the items. 
<br>
- <a href="removegadgetitem.html">RemoveGadgetItem()</a>: Remove an item. 
<br>
- <a href="setgadgetitemtext.html">SetGadgetItemText()</a>: Changes the gadget item text. 
<br>
- <a href="setgadgetitemimage.html">SetGadgetItemImage()</a>: Changes the gadget item image (need to be created with the <font color="#924B72">#PB_ComboBox_Image</font> flag). 
<br>
- <a href="getgadgetstate.html">GetGadgetState()</a>: Get the index (starting from 0) of the current element. 
<br>
- <a href="getgadgettext.html">GetGadgetText()</a>: Get the (text) content of the current element. 
<br>
- <a href="setgadgetstate.html">SetGadgetState()</a>: Change the selected element. 
<br>
- <a href="setgadgettext.html">SetGadgetText()</a>: Set the displayed text. If the ComboBoxGadget is not editable, the text must be in the dropdown list. 
<br>
- <a href="getgadgetitemdata.html">GetGadgetItemData()</a>: Returns the value that was stored with item. 
<br>
- <a href="setgadgetitemdata.html">SetGadgetItemData()</a>: Stores a value with the item. 

<br>
<br>
ComboBoxGadget() supports the following events reported by <a href="../window/eventtype.html">EventType()</a>: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_EventType_Change</font>   : The current selection of the text in the edit field changed.
  <font color="#924B72">#PB_EventType_Focus</font>    : The edit field received the keyboard focus (editable ComboBox only).
  <font color="#924B72">#PB_EventType_LostFocus</font>: The edit field lost the keyboard focus (editable ComboBox only).
</font></pre>


</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2"><font color="#006666">  UsePNGImageDecoder</font>()
<font color="#006666">  LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + "examples/sources/Data/world.png")
  
  <b><font color="#006666">If</font></b> <font color="#006666">OpenWindow</font>(0, 0, 0, 270, 180, "ComboBoxGadget", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
<font color="#006666">    ComboBoxGadget</font>(0, 10, 10, 250, 21, <font color="#924B72">#PB_ComboBox_Editable</font>)
<font color="#006666">      AddGadgetItem</font>(0, -1, "ComboBox editable...")

<font color="#006666">    ComboBoxGadget</font>(1, 10, 40, 250, 21, <font color="#924B72">#PB_ComboBox_Image</font>)
<font color="#006666">      AddGadgetItem</font>(1, -1, "ComboBox item with image",<font color="#006666"> ImageID</font>(0))

<font color="#006666">    ComboBoxGadget</font>(2, 10, 70, 250, 21)
      <b><font color="#006666">For</font></b> a = 1 <b><font color="#006666">To</font></b> 5
<font color="#006666">        AddGadgetItem</font>(2, -1,"ComboBox item " +<font color="#006666"> Str</font>(a))
      <b><font color="#006666">Next</font></b>

<font color="#006666">    SetGadgetState</font>(0, 0)
<font color="#006666">    SetGadgetState</font>(1, 0)
<font color="#006666">    SetGadgetState</font>(2, 2)    <font color="#006666">; set (beginning with 0) the third item as active one</font>
    
    <b><font color="#006666">Repeat</font></b> : <b><font color="#006666">Until</font></b> <font color="#006666">WaitWindowEvent</font>() = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#006666">EndIf</font></b>
</font></pre>
<br>
<p><img src="../HelpPictures/comboboxgadget.png"></p>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="addgadgetitem.html">AddGadgetItem()</a>, <a href="removegadgetitem.html">RemoveGadgetItem()</a>, <a href="countgadgetitems.html">CountGadgetItems()</a>, <a href="cleargadgetitems.html">ClearGadgetItems()</a>, 
<a href="getgadgetstate.html">GetGadgetState()</a>, <a href="setgadgetstate.html">SetGadgetState()</a>, <a href="getgadgettext.html">GetGadgetText()</a>, <a href="setgadgettext.html">SetGadgetText()</a> 
<a href="getgadgetitemtext.html">GetGadgetItemText()</a>, <a href="setgadgetitemtext.html">SetGadgetItemText()</a>, <a href="setgadgetitemimage.html">SetGadgetItemImage()</a> 
<a href="getgadgetitemdata.html">GetGadgetItemData()</a>, <a href="setgadgetitemdata.html">SetGadgetItemData()</a>, <a href="explorercombogadget.html">ExplorerComboGadget()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=closegadgetlist.html>CloseGadgetList()</a> - <a href=index.html>Gadget Index</a> - <a href=containergadget.html>ContainerGadget()</a> ->

</body></html>